<?php
/**
 * Created by PhpStorm.
 * User: jin
 * Date: 2015/11/12
 * Time: 17:35
 */

namespace Home\Controller;
use Think\Controller;

class LoginController  extends Controller
{
    function login(){
        $referer = I('get.referer');
        $this->assign('referer',$referer);
        $this->display();
    }
    function loginHandle(){
        if (I('post.name')==="admin" && I('post.pwd')==="qA0130") {
            $_SESSION['user'] = "admin";
            $_SESSION['pass'] = "qA0130";
            $referer =I('post.referer');
            if ($referer) {
                header("Location:$referer");

            }else{
                header("Location:https://yiyuan.snsnb.com/hos303/");
            }
        }else{
            echo "用户名或密码错误";
            die();
        }
    }
}